﻿using ControleRepresentante.Data.Catalogs;
using ControleRepresentante.Data.Helpers;

namespace ControleRepresentante.Data.CatalogSteps
{
    internal class CreateFabricaCatalogStep : CatalogStepBase<ControleRepresentanteCatalogStepTypes>
    {
        protected override ControleRepresentanteCatalogStepTypes CatalogStepType
        {
            get { return ControleRepresentanteCatalogStepTypes.CreateFabrica; }
        }

        public override void Execute(IDataAccess dataAccess)
        {
            CatalogStepHelper catalogStepHelper = new CatalogStepHelper(dataAccess);

            catalogStepHelper
                .CreateTable("Fabrica", false, "UsuariosHolderId")
                    .AddForeignKey("UsuariosHolderId", "UsuariosHolder", "DetailsHolderId")
                    .AddColumn("Nome", ColumnType.ShortString, false, false)
                    .AddColumn("CNPJ", ColumnType.ShortString, false, false)
                    .AddColumn("InscricaoEstadual", ColumnType.ShortString, false, false);

            catalogStepHelper
                .CreateTable("FabricaJolitex")
                    .AddColumn("IsJolitex", ColumnType.Boolean, false, false);
        }
    }
}